<?php

include_once '../model/Category.php';
include_once '../util/database_conn.php';

$name = $_POST['name'];
$description = $_POST['description'];

if ($_POST['flag'] != 'delete') {

    $category = new Category();
    $category->setName($name);
    $category->setDescription($description);
    $category->save();
} else{
    $category = Category::load($_POST('idx'));
    $category->delete();
}

mysql_close($conn);
?>
